<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('功能设置')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-docset-edit" th:object="${sysDocset}">
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">匿名付款下载：</label>
                    <div class="col-sm-8">
                        <input type="checkbox" id="anonypay" th:checked="${sysDocset.anonypay == 1 ? true : false}">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">虚拟文档数量：</label>
                    <div class="col-sm-8">
                        <input name="docNum" th:field="*{docNum}" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">重复文档：</label>
                    <div class="col-sm-8">
                        <input type="checkbox" id="ismd5" th:checked="${sysDocset.ismd5 == 1 ? true : false}">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">默认预览页数：</label>
                    <div class="col-sm-8">
                        <input name="preview" th:field="*{preview}" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">默认阅读币：</label>
                    <div class="col-sm-8">
                        <input name="readpay" th:field="*{readpay}" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">默认下载币：</label>
                    <div class="col-sm-8">
                        <input name="downpay" th:field="*{downpay}" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">末项附加分类：</label>
                    <div class="col-sm-8">
                        <input type="checkbox" id="minfilter" th:checked="${sysDocset.minfilter == 1 ? true : false}">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">末级文档分类：</label>
                    <div class="col-sm-8">
                        <input type="checkbox" id="mintype" th:checked="${sysDocset.mintype == 1 ? true : false}">
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-sm-offset-5 col-sm-10">
                    <button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i>保 存</button>&nbsp;
                </div>
            </div>


    </form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
    var prefix = ctx + "system/docset";
    $("#form-docset-edit").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            var data = $('#form-docset-edit').serializeArray();
            var anonypay = $("input[id='anonypay']").is(':checked') == true ? 1 : 0;
            var minfilter = $("input[id='minfilter']").is(':checked') == true ? 1 : 0;
            var ismd5 = $("input[id='ismd5']").is(':checked') == true ? 1 : 0;
            var mintype = $("input[id='mintype']").is(':checked') == true ? 1 : 0;
            data.push({"name": "mintype", "value": mintype});
            data.push({"name": "minfilter", "value": minfilter});
            data.push({"name": "anonypay", "value": anonypay});
            data.push({"name": "ismd5", "value": ismd5});
            $.operate.save(prefix + "/edit", data,function(result) {
                layer.msg(result.msg, {
                    icon: $.modal.icon(0),
                    time: 500,
                    shade: [0.1, '#8F8F8F']
                });
            });
        }
    }
</script>
</body>
</html>